package com.loan.system.service.impl;

import com.loan.system.domain.SmsSendLogEntity;
import com.loan.system.mapper.SmsSendLogMapper;
import com.loan.system.service.SmsSendLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.Date;


/**
 * @author shiguang
 * @date 2022年09月24日 10:32
 */
@Service
@RequiredArgsConstructor
public class SmsSendLogServiceImpl implements SmsSendLogService {

    private final SmsSendLogMapper smsSendLogMapper;

    @Async
    @Override
    public void asyncSaveSendLog(String type, String companyName, String content, String mobile, Boolean result) {
        SmsSendLogEntity entity = new SmsSendLogEntity();
        entity.setMobile(mobile);
        entity.setContent(content);
        entity.setStatus(result ? "2" : "0");
        entity.setType(type);
        entity.setCreateTime(new Date());
        entity.setCompanyName(companyName);
        smsSendLogMapper.insert(entity);
    }
}
